package edu.hawaii.stack;

import java.util.Iterator;
import java.io.Serializable;

/**
 * Implements a "clear" stack ADT, in the sense that you can use an iterator
 * to see the internal contents of the stack.
 * ClearStack is also a Bean with a read-only attributes called "iterator" and "top".
 *
 * @author Philip M. Johnson 
 * @version $Id: ClearStack.java,v 1.1.1.1 2005/02/02 02:17:52 johnson Exp $
 */
public class ClearStack extends Stack implements Serializable {

  /**
   * Returns an iterator over the elements of the ClearStack.
   * Normally this method would be named "iterator", but we want the iterator
   * to be accessable as a Bean property.
   *
   * @return the iterator
   */
  public Iterator getIterator() {
    return this.elements.iterator();
  } 


  /**
   * Gets the top attribute of the ClearStack object.
   *
   * @return The top value.
   * @exception EmptyStackException If the stack is empty.
   */
  public Object getTop() throws EmptyStackException {
    return this.top();
  }
}
